<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>颜色选择器</title>
  <style>
    body {
      font-family: Arial, sans-serif;
    }

    select {
      padding: 10px;
      margin-right: 10px;
    }

    button {
      padding: 10px 20px;
      background-color: #007BFF;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
    }

    button:hover {
      background-color: #0056b3;
    }

    #text {
      margin-top: 20px;
      font-size: 24px;
    }
  </style>
</head>

<body>
  <select id="colorSelector">
    <option value="red">红</option>
    <option value="yellow">黄</option>
    <option value="blue">蓝</option>
  </select>
  <button onclick="changeTextColor()">确定</button>
  <div id="text">这是一段示例文本</div>

  <script>
    function changeTextColor() {
      var selectElement = document.getElementById('colorSelector');
      var selectedColor = selectElement.value;
      var textElement = document.getElementById('text');
      textElement.style.color = selectedColor;
    }
  </script>
</body>

</html>